package com.xyoto.community.utils;

import java.time.LocalDateTime;

/**
 * 用户方面的工具类
 */
public class StarUtils {
    /**
     * 通过日期计算出星座
     * @param time
     * @return
     */
    public static String calculateConstellation(LocalDateTime time) {
        String constellation = "";
        int month = time.getMonthValue();
        int day = time.getDayOfMonth();
        switch (month) {
            case 1:
                constellation = day < 21 ? "摩羯座" : "水瓶座";
                break;
            case 2:
                constellation = day < 20 ? "水瓶座" : "双鱼座";
                break;
            case 3:
                constellation = day < 21 ? "双鱼座" : "白羊座";
                break;
            case 4:
                constellation = day < 21 ? "白羊座" : "金牛座";
                break;
            case 5:
                constellation = day < 22 ? "金牛座" : "双子座";
                break;
            case 6:
                constellation = day < 22 ? "双子座" : "巨蟹座";
                break;
            case 7:
                constellation = day < 23 ? "巨蟹座" : "狮子座";
                break;
            case 8:
                constellation = day < 24 ? "狮子座" : "处女座";
                break;
            case 9:
                constellation = day < 24 ? "处女座" : "天秤座";
                break;
            case 10:
                constellation = day < 24 ? "天秤座" : "天蝎座";
                break;
            case 11:
                constellation = day < 23 ? "天蝎座" : "射手座";
                break;
            case 12:
                constellation = day < 22 ? "射手座" : "摩羯座";
                break;
        }
        return constellation;
    }
}
